package com.cbs.java.component.application.sample;


import com.cbs.java.component.application.Application;
import com.cbs.java.component.application.BaseArgs;
import com.cbs.java.component.application.Configs;
import org.fusesource.jansi.Ansi;

/**
 * Created by broche on 05/08/2017.
 */
public final class MyApplication extends Application {
    private MyArgs args = new MyArgs();

    public MyApplication(String[] args) {
        super(args);

        StringBuilder configPath = new StringBuilder();
        Configs appconfigs;
        appconfigs = new Configs(this, "appconfig.properties");
        appconfigs.setProperty("aaaaa", "456");
        appconfigs.save();
    }

    @Override
    public String applicationName() {
        return "test";
    }

    @Override
    public void start() {
        super.start();
        System.out.println(Ansi.ansi().fg(Ansi.Color.RED).a(getArgs().isVerbose()));
        getConfigs().setProperty("test2", System.currentTimeMillis() + "");
        getConfigs().save();

    }

    @Override
    public BaseArgs getArgs() {
        return args;
    }

    public static void main(String[] args) {
        MyApplication application = new MyApplication(args);
        application.start();
    }
}
